package com.huya.live.web;

import com.huya.live.ProductWebSocket;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: live
 * @description: index_web
 * @author: Geminga
 * @create: 2019-11-16 21:02
 **/
@RestController
public class IndexController {


    @GetMapping(value = "/")
    public Object index() {

        return "Hello,ALl。This is yuanmayouchuang webSocket demo！";
    }

    @GetMapping("test")
    public String test(String userId, String message) throws Exception {
        if (userId == "" || userId == null) {
            return "发送用户id不能为空";
        }
        if (message == "" || message == null) {
            return "发送信息不能为空";
        }
        new ProductWebSocket().systemSendToUser(userId, message);
        return "发送成功！";
    }

    @RequestMapping(value = "/ws")
    public String ws() {
        return "ws";
    }

    @RequestMapping(value = "/ws1")
    public String ws1() {
        return "ws1";
    }
}
